class Singleton(type):
    _instances = {}

    def __call__(cls, *args, **kwargs):
        instance_name = ''
        try:
            if args:
                instance_name = str(cls) + str(args[0])
        except:
            pass
        if not instance_name:
            instance_name = str(cls)
        if instance_name not in cls._instances:
            cls._instances[instance_name] = super(Singleton, cls).__call__(*args, **kwargs)
        return cls._instances[instance_name]